package com.lt.lumentracks.service.Impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lt.lumentracks.entity.po.Tag;
import com.lt.lumentracks.entity.vo.tag.TagVO_info;
import com.lt.lumentracks.mapper.TagMapper;
import com.lt.lumentracks.service.ITagService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 标签表 服务实现类
 * </p>
 *
 * @author swl
 * @since 2025-07-22
 */
@Service
public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements ITagService {

    // 获取所有正常启用的标签
    @Override
    public List<TagVO_info> getNormalTag() {

        QueryWrapper<Tag> qw = new QueryWrapper<>();
        qw.eq("status", 1);
        qw.orderByDesc("sort_order");
        List<Tag> list = this.list(qw);

        return list.stream().map(tag -> BeanUtil.copyProperties(tag, TagVO_info.class)).toList();
    }
}
